<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="com.usernet.product.tools.AdminRight"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<bean:message key="base"/>">
		<link rel="stylesheet" type="text/css" href="resources/css/style.css">
		<script src="resources/js/comm.js"></script>
		<script src="resources/js/jquery-1.4.min.js"></script>
		<script type="text/javascript">
	function checkForm() {
		var name = $("#name").val();
		var develope = $("#develope").val();
		var share = document.getElementById("shareRadio");
		var money = $("#money").val();
		var typeId = $("#typeId").val();
		var recId = $("#recId").val();
		var tag = $("#tag").val();
		var remark = document.getElementById("remark").value;
		if(name == ""){
			alert("请输入软件名称 "); 
		}else if(develope == ""){
			alert("请输入开发商 ");   
		}else if(share.checked && money==""){
			alert("请输入金额\n类型为数字"); 
		}else if(typeId==0){
			alert("请选择所属分类");
		}else if(remark == ""){
			alert("请输入软件介绍 ");   
		}else {
				loading();
				submitForm("addform");
		}
	}
	function changeRadio(bool){
		if(bool)
			$("#share_span").css("display","block");
		else
			$("#share_span").css("display","none");
	}
</script>
	</head>

	<body onkeydown="if(event.keyCode==27) return false;">
		<jsp:include page="../inc/header.jsp"></jsp:include>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td height="30" background="resources/images/other/tab_05.gif">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td width="12" height="30">
								<img src="resources/images/other/tab_03.gif" width="12"
									height="30" />
							</td>
							<td>
								<div class="page_title">
									<img align="middle" src="resources/images/other/tb.gif"
										width="16" height="16" />
									软件信息管理 > 添加软件
								</div>
							</td>
							<td>
								<div class="button_bar">
									<input value="下一步" type="button" id="btn_ok" class="common_button" onclick="checkForm();">
								</div>
							</td>
							<td width="16" height="30">
								<img src="resources/images/other/tab_07.gif" width="16"
									height="30" />
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td width="8" background="resources/images/other/tab_12.gif">
							</td>
							<td>
								<form action="software.do" method="post" id="addform">
									<input type="hidden" name="method" value="doAdd2">
									<table cellspacing="1" cellpadding="0" class="query_form_table">
										<tr>
											<th colspan="2"><b>第2步:填写软件信息</b></th>
										</tr>
										<tr>
											<th>软件名称</th>
											<td><input name="name" id="name" class="comm_input" maxlength="50"/><span class="red_star">*</span></td>
										</tr>
										<tr style="display: none;">
											<th>推荐类别</th>
											<td>
												<input name="tops" type="radio"/ value="2">顶置
												<input name="tops" type="radio" value="1"/>推荐
												<input name="tops" type="radio" value="0" checked="checked"/>默认
											</td>
										</tr>
										<tr>
											<th>开发商</th>
											<td><input id="develope" name="develope" class="comm_input" maxlength="50" value=""/></td>
										</tr>
										<tr style="display: none;">
											<th>是否收费</th>
											<td>
												<input onclick="changeRadio(false);" name="share" type="radio" checked="checked" value="0"/>免费
												<input id="shareRadio" onclick="changeRadio(true);" name="share" type="radio" value="1"/>收费
												<span id="share_span" style="display: none;"><input id="money" name="money" class="comm_input" onpropertychange="if(!/^\d*(\.\d*)?$/.test(this.value))this.value=this.value.substr(0,this.value.length-1)" onpaste="return false"/>元<span class="red_star">*</span></span>
											</td>
										</tr>
										<tr>
											<th>所属分类</th>
											<td>
												<select id="typeId" name="typeId" class="comm_input">
													<option value="0">---请选择分类---</option>
													<logic:iterate id="type" name="types">
														<option value="${type.id }">${type.name }</option>
													</logic:iterate>
												</select>
												<span class="red_star">*</span>
											</td>
										</tr>
										<tr style="display: none;">
											<th>所属专题</th>
											<td>
												<select id="recId" name="recId" class="comm_input">
													<option value="0">---请选择专题---</option>
													<logic:iterate id="rec" name="resourcesList">
														<option value="${rec.id }">${rec.name }</option>
													</logic:iterate>
												</select>
											</td>
										</tr>
										<tr <logic:notEqual value="<%=String.valueOf(AdminRight.supers) %>" name="admin" property="flag">style="display:none;"</logic:notEqual>>
											<th>评分信息</th>
											<td>
												<select name="avg" class="comm_input">
														<option value="0">☆☆☆☆☆</option>
														<option value="1">★☆☆☆☆</option>
														<option value="2">★★☆☆☆</option>
														<option value="3">★★★☆☆</option>
														<option value="4">★★★★☆</option>
														<option value="5">★★★★★</option>
													</select>
												<span class="red_star">*</span>
											</td>
										</tr>
										<tr style="display: none;">
											<th>标签</th>
											<td>
												<input id="tag" name="tag" class="comm_input"  maxlength="100"/>
												<span class="red_star">多个标签用"|"隔开</span>
											</td>
										</tr>
										<tr style="display: none;">
											<th>分享内容</th>
											<td>
												<textarea name="res" style="width:70%;height: 100px;"></textarea>
											</td>
										</tr>
										<tr>
											<th>软件描述</th>
											<td>
												<textarea id="remark" name="remark" style="width:70%;height: 200px;"></textarea>
												<span class="red_star">*</span>
											</td>
										</tr>
										<tr>
											<th colspan="2"><b>APK安装包信息</b></th>
										</tr>
										<tr>
											<th>版本</th>
											<td>${apk.versionName }<input type="hidden" name="version" value="${apk.versionName }"/></td>
										</tr>
										<tr>
											<th>支持版本</th>
											<td>${apk.sdkVersion }<input type="hidden" name="sdk" value="${apk.sdkVersion }"/></td>
										</tr>
										<tr>
											<th>版本号</th>
											<td>${apk.versionCode }<input type="hidden" name="code" value="${apk.versionCode }"/></td>
										</tr>
										<tr>
											<th>包名</th>
											<td>${apk.packageName }<input type="hidden" name="package_" value="${apk.packageName }"/></td>
										</tr>
										<tr>
											<th>大小</th>
											<td>${apk.size }<input type="hidden" name="size" value="${apk.size }"/></td>
										</tr>
										<tr>
											<th>图标</th>
											<td>
											<logic:notPresent name="apk" property="icon"><span class="red_star">没有图标</span></logic:notPresent><logic:present name="apk" property="icon"><img src="upload/icon/${apk.icon }"/><input type="hidden" name="iconName" value="${apk.icon }"/></logic:present>
											<input type="hidden" name="download" value="${apk.download }"/></td>
										</tr>
									</table>
								</form>
							</td>
							<td width="8" background="resources/images/other/tab_15.gif">
							</td>
						</tr>
						<tr>
							<td width="8" background="resources/images/other/tab_12.gif"></td>
							<td>
								<b>上传新软件步骤：</b>
								<br/>
								第1步:上传APK文件 选择需要发布软件的APK文件，上传成功后可以智能分析出您的软件中诸如版本，包名，icon等信息;
								<br/>
								第2步:填写app信息 
								该步骤您会看到智能分析出的软件信息，除此之外，需要您输入软件的名字，描述，同时需要您选择分类，标签等信息;
								<br/>
								第3步:上传软件截图
								在这里上传这个软件用的节截图，使得用户更了解这个软件;
							</td>
							<td width="8" background="resources/images/other/tab_15.gif"></td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td height="35" background="resources/images/other/tab_19.gif">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td width="12" height="30">
								<img src="resources/images/other/tab_18.gif" width="12"
									height="35" />
							</td>
							<td>
								&nbsp;
							</td>
							<td width="16">
								<img src="resources/images/other/tab_20.gif" width="16"
									height="35" />
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</body>
</html>
<jsp:include page="../inc/footer.jsp"></jsp:include>